<template>
  <div class="hotProductItemBox" data-v-1712b3c9>
    <a
      href="javascript:;"
      class="hotItem mb15"
      data-v-1712b3c9
      v-for="(item,index) in list"
      :key="index"
      @click="detailsdata(index)"
    >
      <img :src="item.picUrl" :alt="item.title" class="hotMainPic" data-v-1712b3c9 />
      <div class="price" data-v-1712b3c9>
        <sub class="iconfont iconqian" data-v-1712b3c9></sub>
        <strong class="numFont price" data-v-1712b3c9>{{item.price}}</strong>
      </div>
      <p class="productName" data-v-1712b3c9>{{item.title}}</p>
      <div class="socketNums" data-v-1712b3c9>
        <span data-v-1712b3c9>重量</span>
        <strong data-v-1712b3c9>{{item.weight}}</strong>
        <em data-v-1712b3c9>kg/件</em>
      </div>
    </a>
  </div>
</template>

<script>
export default {
  data() {
    return {
      list: []
    };
  },
  created() {
    let url = "/api/productSet/getHotAndNewProduct";

    //根据父级传参获取相应数据
    this.$axios.post(url, { type: "0" }).then(res => {
      console.log(res.data.data);
      this.list = res.data.data;
    });
  },
  methods: {
    detailsdata(id) {
      var arr = [0, id,0];
      this.$router.push({
        path: "/details/" + arr
      });
    }
  }
};
</script>

<style>
</style>